import { createBrowserRouter, Navigate } from 'react-router-dom'
import App from '@/App'
import Login from '@/pages/login'
import Index from '@/pages/index'
import Work from '@/pages/index/children/work'
import User from '@/pages/index/children/user'
import Teacher from '@/pages/index/children/teacher'
import Limit from '@/pages/index/children/limit'
import Class from '@/pages/index/children/class'
import NotFound from '@/pages/notFound'

const Router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
    children: [
      {
        path: '/',
        element: <Index />,
        children: [
          {
            path: '',
            element: <Navigate to="/work" replace />,
          },
          {
            path: '/work',
            element: <Work />,
          },
          {
            path: '/user',
            element: <User />,
          },
          {
            path: '/teacher',
            element: <Teacher />,
          },
          {
            path: '/limit',
            element: <Limit />,
          },
          {
            path: '/class',
            element: <Class />,
          },
        ],
      },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '*',
    element: <NotFound />,
  },
])

export default Router
